package com.xuanyuanzi.all_learning.infrastructure.common.enums;

import java.util.ArrayList;
import java.util.List;

public enum MustTokenEnum {

    NOT_MUST_TOKEN(0, "非必要TOKEN"),

    MUST_TOKEN(1, "必要TOKEN");


    private Integer value;
    private String name;

    private MustTokenEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public Integer getValue() {
        return value;
    }


    public String getName() {
        return name;
    }


    public static MustTokenEnum fromValue(Integer v) {
        for (MustTokenEnum c : MustTokenEnum.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v + "");
    }

    public static MustTokenEnum fromName(String name) {
        for (MustTokenEnum c : MustTokenEnum.values()) {
            if (c.name.equals(name)) {
                return c;
            }
        }
        throw new IllegalArgumentException(name + "");
    }


    public static List<Integer> getValueList() {
        List<Integer> valueList = new ArrayList<>();
        for (MustTokenEnum c : MustTokenEnum.values()) {
            valueList.add(c.getValue());
        }
        return valueList;
    }

    public static List<String> getNameList() {
        List<String> nameList = new ArrayList<>();
        for (MustTokenEnum c : MustTokenEnum.values()) {
            nameList.add(c.getName());
        }
        return nameList;
    }
}
